package com.example.module_service.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.lib_common.view.entity.CarStopEntityItem
import com.example.module_service.databinding.ItemCarStopBinding
import com.example.module_service.databinding.ItemDeviceDetailBinding

class CarStopAdapter(private val data:MutableList<CarStopEntityItem>):RecyclerView.Adapter<CarStopAdapter.CarStopItemViewHolder>(){
    inner class CarStopItemViewHolder(val itemDataBinding: ItemCarStopBinding):RecyclerView.ViewHolder(itemDataBinding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CarStopItemViewHolder {
        return CarStopItemViewHolder(ItemCarStopBinding.inflate(LayoutInflater.from(parent.context),parent,false))
    }

    override fun getItemCount(): Int {
        return data.size
    }

    override fun onBindViewHolder(holder: CarStopItemViewHolder, position: Int) {
        val item = data[position]
        holder.itemDataBinding.apply {
            entity=item
            executePendingBindings()
        }
    }
}